home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_xemacs.idb / usr / freeware / lib / xemacs-20.4 / info / lispref.info-18.z / lispref.info-18
Encoding:
GNU Info File  |  1998-05-21  |  48.8 KB  |  1,211 lines

  1. This is Info file ../../info/lispref.info, produced by Makeinfo version
  2. 1.68 from the input file lispref.texi.
  3.  
  4.    Edition History:
  5.  
  6.    GNU Emacs Lisp Reference Manual Second Edition (v2.01), May 1993 GNU
  7. Emacs Lisp Reference Manual Further Revised (v2.02), August 1993 Lucid
  8. Emacs Lisp Reference Manual (for 19.10) First Edition, March 1994
  9. XEmacs Lisp Programmer's Manual (for 19.12) Second Edition, April 1995
  10. GNU Emacs Lisp Reference Manual v2.4, June 1995 XEmacs Lisp
  11. Programmer's Manual (for 19.13) Third Edition, July 1995 XEmacs Lisp
  12. Reference Manual (for 19.14 and 20.0) v3.1, March 1996 XEmacs Lisp
  13. Reference Manual (for 19.15 and 20.1, 20.2) v3.2, April, May 1997
  14.  
  15.    Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995 Free Software
  16. Foundation, Inc.  Copyright (C) 1994, 1995 Sun Microsystems, Inc.
  17. Copyright (C) 1995, 1996 Ben Wing.
  18.  
  19.    Permission is granted to make and distribute verbatim copies of this
  20. manual provided the copyright notice and this permission notice are
  21. preserved on all copies.
  22.  
  23.    Permission is granted to copy and distribute modified versions of
  24. this manual under the conditions for verbatim copying, provided that the
  25. entire resulting derived work is distributed under the terms of a
  26. permission notice identical to this one.
  27.  
  28.    Permission is granted to copy and distribute translations of this
  29. manual into another language, under the above conditions for modified
  30. versions, except that this permission notice may be stated in a
  31. translation approved by the Foundation.
  32.  
  33.    Permission is granted to copy and distribute modified versions of
  34. this manual under the conditions for verbatim copying, provided also
  35. that the section entitled "GNU General Public License" is included
  36. exactly as in the original, and provided that the entire resulting
  37. derived work is distributed under the terms of a permission notice
  38. identical to this one.
  39.  
  40.    Permission is granted to copy and distribute translations of this
  41. manual into another language, under the above conditions for modified
  42. versions, except that the section entitled "GNU General Public License"
  43. may be included in a translation approved by the Free Software
  44. Foundation instead of in the original English.
  45.  
  46. 
  47. File: lispref.info,  Node: Active Keymaps,  Next: Key Lookup,  Prev: Prefix Keys,  Up: Keymaps
  48.  
  49. Active Keymaps
  50. ==============
  51.  
  52.    XEmacs normally contains many keymaps; at any given time, just a few
  53. of them are "active" in that they participate in the interpretation of
  54. user input.  These are the global keymap, the current buffer's local
  55. keymap, and the keymaps of any enabled minor modes.
  56.  
  57.    The "global keymap" holds the bindings of keys that are defined
  58. regardless of the current buffer, such as `C-f'.  The variable
  59. `global-map' holds this keymap, which is always active.
  60.  
  61.    Each buffer may have another keymap, its "local keymap", which may
  62. contain new or overriding definitions for keys.  The current buffer's
  63. local keymap is always active except when `overriding-local-map' or
  64. `overriding-terminal-local-map' overrides it.  Extents and text
  65. properties can specify an alternative local map for certain parts of the
  66. buffer; see *Note Extents and Events::.
  67.  
  68.    Each minor mode may have a keymap; if it does, the keymap is active
  69. when the minor mode is enabled.
  70.  
  71.    The variable `overriding-local-map' and
  72. `overriding-terminal-local-map', if non-`nil', specify other local
  73. keymaps that override the buffer's local map and all the minor mode
  74. keymaps.
  75.  
  76.    All the active keymaps are used together to determine what command to
  77. execute when a key is entered.  XEmacs searches these maps one by one,
  78. in order of decreasing precedence, until it finds a binding in one of
  79. the maps.
  80.  
  81.    More specifically:
  82.  
  83.    For key-presses, the order of keymaps searched is:
  84.  
  85.    * the `keymap' property of any extent(s) or text properties at point;
  86.  
  87.    * any applicable minor-mode maps;
  88.  
  89.    * the current local map of the current buffer;
  90.  
  91.    * the current global map.
  92.  
  93.    For mouse-clicks, the order of keymaps searched is:
  94.  
  95.    * the current local map of the `mouse-grabbed-buffer' if any;
  96.  
  97.    * the `keymap' property of any extent(s) at the position of the click
  98.      (this includes modeline extents);
  99.  
  100.    * the `modeline-map' of the buffer corresponding to the modeline
  101.      under the mouse (if the click happened over a modeline);
  102.  
  103.    * the value of `toolbar-map' in the current buffer (if the click
  104.      happened over a toolbar);
  105.  
  106.    * the current local map of the buffer under the mouse (does not
  107.      apply to toolbar clicks);
  108.  
  109.    * any applicable minor-mode maps;
  110.  
  111.    * the current global map.
  112.  
  113.    Note that if `overriding-local-map' or
  114. `overriding-terminal-local-map' is non-`nil', *only* those two maps and
  115. the current global map are searched.
  116.  
  117.    The procedure for searching a single keymap is called "key lookup";
  118. see *Note Key Lookup::.
  119.  
  120.    Since every buffer that uses the same major mode normally uses the
  121. same local keymap, you can think of the keymap as local to the mode.  A
  122. change to the local keymap of a buffer (using `local-set-key', for
  123. example) is seen also in the other buffers that share that keymap.
  124.  
  125.    The local keymaps that are used for Lisp mode, C mode, and several
  126. other major modes exist even if they have not yet been used.  These
  127. local maps are the values of the variables `lisp-mode-map',
  128. `c-mode-map', and so on.  For most other modes, which are less
  129. frequently used, the local keymap is constructed only when the mode is
  130. used for the first time in a session.
  131.  
  132.    The minibuffer has local keymaps, too; they contain various
  133. completion and exit commands.  *Note Intro to Minibuffers::.
  134.  
  135.    *Note Standard Keymaps::, for a list of standard keymaps.
  136.  
  137.  - Function: current-keymaps &optional EVENT-OR-KEYS
  138.      This function returns a list of the current keymaps that will be
  139.      searched for bindings.  This lists keymaps such as the current
  140.      local map and the minor-mode maps, but does not list the parents
  141.      of those keymaps.  EVENT-OR-KEYS controls which keymaps will be
  142.      listed.  If EVENT-OR-KEYS is a mouse event (or a vector whose last
  143.      element is a mouse event), the keymaps for that mouse event will
  144.      be listed.  Otherwise, the keymaps for key presses will be listed.
  145.  
  146.  - Variable: global-map
  147.      This variable contains the default global keymap that maps XEmacs
  148.      keyboard input to commands.  The global keymap is normally this
  149.      keymap.  The default global keymap is a full keymap that binds
  150.      `self-insert-command' to all of the printing characters.
  151.  
  152.      It is normal practice to change the bindings in the global map,
  153.      but you should not assign this variable any value other than the
  154.      keymap it starts out with.
  155.  
  156.  - Function: current-global-map
  157.      This function returns the current global keymap.  This is the same
  158.      as the value of `global-map' unless you change one or the other.
  159.  
  160.           (current-global-map)
  161.           => #<keymap global-map 639 entries 0x221>
  162.  
  163.  - Function: current-local-map
  164.      This function returns the current buffer's local keymap, or `nil'
  165.      if it has none.  In the following example, the keymap for the
  166.      `*scratch*' buffer (using Lisp Interaction mode) has a number of
  167.      entries, including one prefix key, `C-x'.
  168.  
  169.           (current-local-map)
  170.           => #<keymap lisp-interaction-mode-map 5 entries 0x558>
  171.           (describe-bindings-internal (current-local-map))
  172.           =>  ; Inserted into the buffer:
  173.           backspace    backward-delete-char-untabify
  174.           linefeed    eval-print-last-sexp
  175.           delete        delete-char
  176.           C-j        eval-print-last-sexp
  177.           C-x        << Prefix Command >>
  178.           M-tab        lisp-complete-symbol
  179.           M-;        lisp-indent-for-comment
  180.           M-C-i        lisp-complete-symbol
  181.           M-C-q        indent-sexp
  182.           M-C-x        eval-defun
  183.           Alt-backspace    backward-kill-sexp
  184.           Alt-delete    kill-sexp
  185.           
  186.           C-x x        edebug-defun
  187.  
  188.  - Function: current-minor-mode-maps
  189.      This function returns a list of the keymaps of currently enabled
  190.      minor modes.
  191.  
  192.  - Function: use-global-map KEYMAP
  193.      This function makes KEYMAP the new current global keymap.  It
  194.      returns `nil'.
  195.  
  196.      It is very unusual to change the global keymap.
  197.  
  198.  - Function: use-local-map KEYMAP &optional BUFFER
  199.      This function makes KEYMAP the new local keymap of BUFFER.  BUFFER
  200.      defaults to the current buffer.  If KEYMAP is `nil', then the
  201.      buffer has no local keymap.  `use-local-map' returns `nil'.  Most
  202.      major mode commands use this function.
  203.  
  204.  - Variable: minor-mode-map-alist
  205.      This variable is an alist describing keymaps that may or may not be
  206.      active according to the values of certain variables.  Its elements
  207.      look like this:
  208.  
  209.           (VARIABLE . KEYMAP)
  210.  
  211.      The keymap KEYMAP is active whenever VARIABLE has a non-`nil'
  212.      value.  Typically VARIABLE is the variable that enables or
  213.      disables a minor mode.  *Note Keymaps and Minor Modes::.
  214.  
  215.      Note that elements of `minor-mode-map-alist' do not have the same
  216.      structure as elements of `minor-mode-alist'.  The map must be the
  217.      CDR of the element; a list with the map as the second element will
  218.      not do.
  219.  
  220.      What's more, the keymap itself must appear in the CDR.  It does not
  221.      work to store a variable in the CDR and make the map the value of
  222.      that variable.
  223.  
  224.      When more than one minor mode keymap is active, their order of
  225.      priority is the order of `minor-mode-map-alist'.  But you should
  226.      design minor modes so that they don't interfere with each other.
  227.      If you do this properly, the order will not matter.
  228.  
  229.      See also `minor-mode-key-binding', above.  See *Note Keymaps and
  230.      Minor Modes::, for more information about minor modes.
  231.  
  232.  - Variable: modeline-map
  233.      This variable holds the keymap consulted for mouse-clicks on the
  234.      modeline of a window.  This variable may be buffer-local; its
  235.      value will be looked up in the buffer of the window whose modeline
  236.      was clicked upon.
  237.  
  238.  - Variable: toolbar-map
  239.      This variable holds the keymap consulted for mouse-clicks over a
  240.      toolbar.
  241.  
  242.  - Variable: mouse-grabbed-buffer
  243.      If non-`nil', a buffer which should be consulted first for all
  244.      mouse activity.  When a mouse-click is processed, it will first be
  245.      looked up in the local-map of this buffer, and then through the
  246.      normal mechanism if there is no binding for that click.  This
  247.      buffer's value of `mode-motion-hook' will be consulted instead of
  248.      the `mode-motion-hook' of the buffer of the window under the mouse.
  249.      You should *bind* this, not set it.
  250.  
  251.  - Variable: overriding-local-map
  252.      If non-`nil', this variable holds a keymap to use instead of the
  253.      buffer's local keymap and instead of all the minor mode keymaps.
  254.      This keymap, if any, overrides all other maps that would have been
  255.      active, except for the current global map.
  256.  
  257.  - Variable: overriding-terminal-local-map
  258.      If non-`nil', this variable holds a keymap to use instead of the
  259.      buffer's local keymap and instead of all the minor mode keymaps,
  260.      but for the selected console only. (In other words, this variable
  261.      is always console-local; putting a keymap here only applies to
  262.      keystrokes coming from the selected console.  *Note Consoles and
  263.      Devices::.) This keymap, if any, overrides all other maps that
  264.      would have been active, except for the current global map.
  265.  
  266. 
  267. File: lispref.info,  Node: Key Lookup,  Next: Functions for Key Lookup,  Prev: Active Keymaps,  Up: Keymaps
  268.  
  269. Key Lookup
  270. ==========
  271.  
  272.    "Key lookup" is the process of finding the binding of a key sequence
  273. from a given keymap.  Actual execution of the binding is not part of
  274. key lookup.
  275.  
  276.    Key lookup uses just the event type of each event in the key
  277. sequence; the rest of the event is ignored.  In fact, a key sequence
  278. used for key lookup may designate mouse events with just their types
  279. (symbols) instead of with entire mouse events (lists).  *Note Events::.
  280. Such a pseudo-key-sequence is insufficient for `command-execute', but
  281. it is sufficient for looking up or rebinding a key.
  282.  
  283.    When the key sequence consists of multiple events, key lookup
  284. processes the events sequentially: the binding of the first event is
  285. found, and must be a keymap; then the second event's binding is found in
  286. that keymap, and so on until all the events in the key sequence are used
  287. up.  (The binding thus found for the last event may or may not be a
  288. keymap.)  Thus, the process of key lookup is defined in terms of a
  289. simpler process for looking up a single event in a keymap.  How that is
  290. done depends on the type of object associated with the event in that
  291. keymap.
  292.  
  293.    Let's use the term "keymap entry" to describe the value found by
  294. looking up an event type in a keymap.  (This doesn't include the item
  295. string and other extra elements in menu key bindings because
  296. `lookup-key' and other key lookup functions don't include them in the
  297. returned value.)  While any Lisp object may be stored in a keymap as a
  298. keymap entry, not all make sense for key lookup.  Here is a list of the
  299. meaningful kinds of keymap entries:
  300.  
  301. `nil'
  302.      `nil' means that the events used so far in the lookup form an
  303.      undefined key.  When a keymap fails to mention an event type at
  304.      all, and has no default binding, that is equivalent to a binding
  305.      of `nil' for that event type.
  306.  
  307. KEYMAP
  308.      The events used so far in the lookup form a prefix key.  The next
  309.      event of the key sequence is looked up in KEYMAP.
  310.  
  311. COMMAND
  312.      The events used so far in the lookup form a complete key, and
  313.      COMMAND is its binding.  *Note What Is a Function::.
  314.  
  315. ARRAY
  316.      The array (either a string or a vector) is a keyboard macro.  The
  317.      events used so far in the lookup form a complete key, and the
  318.      array is its binding.  See *Note Keyboard Macros::, for more
  319.      information. (Note that you cannot use a shortened form of a key
  320.      sequence here, such as `(control y)'; you must use the full form
  321.      `[(control y)]'.  *Note Key Sequences::.)
  322.  
  323. LIST
  324.      The meaning of a list depends on the types of the elements of the
  325.      list.
  326.  
  327.         * If the CAR of LIST is `lambda', then the list is a lambda
  328.           expression.  This is presumed to be a command, and is treated
  329.           as such (see above).
  330.  
  331.         * If the CAR of LIST is a keymap and the CDR is an event type,
  332.           then this is an "indirect entry":
  333.  
  334.                (OTHERMAP . OTHERTYPE)
  335.  
  336.           When key lookup encounters an indirect entry, it looks up
  337.           instead the binding of OTHERTYPE in OTHERMAP and uses that.
  338.  
  339.           This feature permits you to define one key as an alias for
  340.           another key.  For example, an entry whose CAR is the keymap
  341.           called `esc-map' and whose CDR is 32 (the code for <SPC>)
  342.           means, "Use the global binding of `Meta-<SPC>', whatever that
  343.           may be."
  344.  
  345. SYMBOL
  346.      The function definition of SYMBOL is used in place of SYMBOL.  If
  347.      that too is a symbol, then this process is repeated, any number of
  348.      times.  Ultimately this should lead to an object that is a keymap,
  349.      a command or a keyboard macro.  A list is allowed if it is a
  350.      keymap or a command, but indirect entries are not understood when
  351.      found via symbols.
  352.  
  353.      Note that keymaps and keyboard macros (strings and vectors) are not
  354.      valid functions, so a symbol with a keymap, string, or vector as
  355.      its function definition is invalid as a function.  It is, however,
  356.      valid as a key binding.  If the definition is a keyboard macro,
  357.      then the symbol is also valid as an argument to `command-execute'
  358.      (*note Interactive Call::.).
  359.  
  360.      The symbol `undefined' is worth special mention: it means to treat
  361.      the key as undefined.  Strictly speaking, the key is defined, and
  362.      its binding is the command `undefined'; but that command does the
  363.      same thing that is done automatically for an undefined key: it
  364.      rings the bell (by calling `ding') but does not signal an error.
  365.  
  366.      `undefined' is used in local keymaps to override a global key
  367.      binding and make the key "undefined" locally.  A local binding of
  368.      `nil' would fail to do this because it would not override the
  369.      global binding.
  370.  
  371. ANYTHING ELSE
  372.      If any other type of object is found, the events used so far in the
  373.      lookup form a complete key, and the object is its binding, but the
  374.      binding is not executable as a command.
  375.  
  376.    In short, a keymap entry may be a keymap, a command, a keyboard
  377. macro, a symbol that leads to one of them, or an indirection or `nil'.
  378.  
  379. 
  380. File: lispref.info,  Node: Functions for Key Lookup,  Next: Changing Key Bindings,  Prev: Key Lookup,  Up: Keymaps
  381.  
  382. Functions for Key Lookup
  383. ========================
  384.  
  385.    Here are the functions and variables pertaining to key lookup.
  386.  
  387.  - Function: lookup-key KEYMAP KEY &optional ACCEPT-DEFAULTS
  388.      This function returns the definition of KEY in KEYMAP.  If the
  389.      string or vector KEY is not a valid key sequence according to the
  390.      prefix keys specified in KEYMAP (which means it is "too long" and
  391.      has extra events at the end), then the value is a number, the
  392.      number of events at the front of KEY that compose a complete key.
  393.  
  394.      If ACCEPT-DEFAULTS is non-`nil', then `lookup-key' considers
  395.      default bindings as well as bindings for the specific events in
  396.      KEY.  Otherwise, `lookup-key' reports only bindings for the
  397.      specific sequence KEY, ignoring default bindings except when you
  398.      explicitly ask about them.
  399.  
  400.      All the other functions described in this chapter that look up
  401.      keys use `lookup-key'.
  402.  
  403.           (lookup-key (current-global-map) "\C-x\C-f")
  404.               => find-file
  405.           (lookup-key (current-global-map) "\C-x\C-f12345")
  406.               => 2
  407.  
  408.      If KEY begins with the character whose value is contained in
  409.      `meta-prefix-char', that character is implicitly removed and the
  410.      <META> modifier added to the key.  Thus, the first example below is
  411.      handled by conversion into the second example.
  412.  
  413.           (lookup-key (current-global-map) "\ef")
  414.               => forward-word
  415.           (lookup-key (current-global-map) "\M-f")
  416.               => forward-word
  417.  
  418.      Unlike `read-key-sequence', this function does not modify the
  419.      specified events in ways that discard information (*note Key
  420.      Sequence Input::.).  In particular, it does not convert letters to
  421.      lower case.
  422.  
  423.  - Command: undefined
  424.      Used in keymaps to undefine keys.  If a key sequence is defined to
  425.      this, invoking this key sequence causes a "key undefined" error,
  426.      just as if the key sequence had no binding.
  427.  
  428.  - Function: key-binding KEY &optional ACCEPT-DEFAULTS
  429.      This function returns the binding for KEY in the current keymaps,
  430.      trying all the active keymaps.  The result is `nil' if KEY is
  431.      undefined in the keymaps.
  432.  
  433.      The argument ACCEPT-DEFAULTS controls checking for default
  434.      bindings, as in `lookup-key' (above).
  435.  
  436.           (key-binding "\C-x\C-f")
  437.               => find-file
  438.           (key-binding '(control home))
  439.               => beginning-of-buffer
  440.           (key-binding [escape escape escape])
  441.               => keyboard-escape-quit
  442.  
  443.  - Function: local-key-binding KEY &optional ACCEPT-DEFAULTS
  444.      This function returns the binding for KEY in the current local
  445.      keymap, or `nil' if it is undefined there.
  446.  
  447.      The argument ACCEPT-DEFAULTS controls checking for default
  448.      bindings, as in `lookup-key' (above).
  449.  
  450.  - Function: global-key-binding KEY &optional ACCEPT-DEFAULTS
  451.      This function returns the binding for command KEY in the current
  452.      global keymap, or `nil' if it is undefined there.
  453.  
  454.      The argument ACCEPT-DEFAULTS controls checking for default
  455.      bindings, as in `lookup-key' (above).
  456.  
  457.  - Function: minor-mode-key-binding KEY &optional ACCEPT-DEFAULTS
  458.      This function returns a list of all the active minor mode bindings
  459.      of KEY.  More precisely, it returns an alist of pairs `(MODENAME .
  460.      BINDING)', where MODENAME is the variable that enables the minor
  461.      mode, and BINDING is KEY's binding in that mode.  If KEY has no
  462.      minor-mode bindings, the value is `nil'.
  463.  
  464.      If the first binding is not a prefix command, all subsequent
  465.      bindings from other minor modes are omitted, since they would be
  466.      completely shadowed.  Similarly, the list omits non-prefix
  467.      bindings that follow prefix bindings.
  468.  
  469.      The argument ACCEPT-DEFAULTS controls checking for default
  470.      bindings, as in `lookup-key' (above).
  471.  
  472.  - Variable: meta-prefix-char
  473.      This variable is the meta-prefix character code.  It is used when
  474.      translating a two-character sequence to a meta character so it can
  475.      be looked up in a keymap.  For useful results, the value should be
  476.      a prefix event (*note Prefix Keys::.).  The default value is
  477.      `?\^[' (integer 27), which is the ASCII character usually produced
  478.      by the <ESC> key.
  479.  
  480.      As long as the value of `meta-prefix-char' remains `?\^[', key
  481.      lookup translates `<ESC> b' into `M-b', which is normally defined
  482.      as the `backward-word' command.  However, if you set
  483.      `meta-prefix-char' to `?\^X' (i.e. the keystroke `C-x') or its
  484.      equivalent ASCII code `24', then XEmacs will translate `C-x b'
  485.      (whose standard binding is the `switch-to-buffer' command) into
  486.      `M-b'.
  487.  
  488.           meta-prefix-char                    ; The default value.
  489.                => ?\^[   ; Under XEmacs 20.
  490.                => 27     ; Under XEmacs 19.
  491.  
  492.           (key-binding "\eb")
  493.                => backward-word
  494.  
  495.           ?\C-x                               ; The print representation
  496.                                                      ;   of a character.
  497.                => ?\^X   ; Under XEmacs 20.
  498.                => 24     ; Under XEmacs 19.
  499.  
  500.           (setq meta-prefix-char 24)
  501.                => 24
  502.  
  503.           (key-binding "\C-xb")
  504.                => backward-word            ; Now, typing `C-x b' is
  505.                                               ;   like typing `M-b'.
  506.           
  507.           (setq meta-prefix-char ?\e)          ; Avoid confusion!
  508.                                                ; Restore the default value!
  509.                => ?\^[   ; Under XEmacs 20.
  510.                => 27     ; Under XEmacs 19.
  511.  
  512. 
  513. File: lispref.info,  Node: Changing Key Bindings,  Next: Key Binding Commands,  Prev: Functions for Key Lookup,  Up: Keymaps
  514.  
  515. Changing Key Bindings
  516. =====================
  517.  
  518.    The way to rebind a key is to change its entry in a keymap.  If you
  519. change a binding in the global keymap, the change is effective in all
  520. buffers (though it has no direct effect in buffers that shadow the
  521. global binding with a local one).  If you change the current buffer's
  522. local map, that usually affects all buffers using the same major mode.
  523. The `global-set-key' and `local-set-key' functions are convenient
  524. interfaces for these operations (*note Key Binding Commands::.).  You
  525. can also use `define-key', a more general function; then you must
  526. specify explicitly the map to change.
  527.  
  528.    The way to specify the key sequence that you want to rebind is
  529. described above (*note Key Sequences::.).
  530.  
  531.    For the functions below, an error is signaled if KEYMAP is not a
  532. keymap or if KEY is not a string or vector representing a key sequence.
  533. You can use event types (symbols) as shorthand for events that are
  534. lists.
  535.  
  536.  - Function: define-key KEYMAP KEY BINDING
  537.      This function sets the binding for KEY in KEYMAP.  (If KEY is more
  538.      than one event long, the change is actually made in another keymap
  539.      reached from KEYMAP.)  The argument BINDING can be any Lisp
  540.      object, but only certain types are meaningful.  (For a list of
  541.      meaningful types, see *Note Key Lookup::.)  The value returned by
  542.      `define-key' is BINDING.
  543.  
  544.      Every prefix of KEY must be a prefix key (i.e., bound to a keymap)
  545.      or undefined; otherwise an error is signaled.
  546.  
  547.      If some prefix of KEY is undefined, then `define-key' defines it
  548.      as a prefix key so that the rest of KEY may be defined as
  549.      specified.
  550.  
  551.    Here is an example that creates a sparse keymap and makes a number of
  552. bindings in it:
  553.  
  554.      (setq map (make-sparse-keymap))
  555.          => #<keymap 0 entries 0xbee>
  556.  
  557.      (define-key map "\C-f" 'forward-char)
  558.          => forward-char
  559.  
  560.      map
  561.          => #<keymap 1 entry 0xbee>
  562.      (describe-bindings-internal map)
  563.      =>   ; (Inserted in buffer)
  564.      C-f             forward-char
  565.  
  566.      ;; Build sparse submap for `C-x' and bind `f' in that.
  567.      (define-key map "\C-xf" 'forward-word)
  568.          => forward-word
  569.  
  570.      map
  571.          => #<keymap 2 entries 0xbee>
  572.      (describe-bindings-internal map)
  573.      =>   ; (Inserted in buffer)
  574.      C-f             forward-char
  575.      C-x             << Prefix Command >>
  576.      
  577.      C-x f           forward-word
  578.  
  579.      ;; Bind `C-p' to the `ctl-x-map'.
  580.      (define-key map "\C-p" ctl-x-map)
  581.      ;; `ctl-x-map'
  582.      => #<keymap Control-X-prefix 77 entries 0x3bf>
  583.  
  584.      ;; Bind `C-f' to `foo' in the `ctl-x-map'.
  585.      (define-key map "\C-p\C-f" 'foo)
  586.      => foo
  587.  
  588.      map
  589.          => #<keymap 3 entries 0xbee>
  590.      (describe-bindings-internal map)
  591.      =>   ; (Inserted in buffer)
  592.      C-f             forward-char
  593.      C-p             << Prefix command Control-X-prefix >>
  594.      C-x             << Prefix Command >>
  595.      
  596.      C-p tab         indent-rigidly
  597.      C-p $           set-selective-display
  598.      C-p '           expand-abbrev
  599.      C-p (           start-kbd-macro
  600.      C-p )           end-kbd-macro
  601.         ...
  602.      C-p C-x         exchange-point-and-mark
  603.      C-p C-z         suspend-or-iconify-emacs
  604.      C-p M-escape    repeat-complex-command
  605.      C-p M-C-[       repeat-complex-command
  606.      
  607.      C-x f           forward-word
  608.      
  609.      C-p 4 .         find-tag-other-window
  610.         ...
  611.      C-p 4 C-o       display-buffer
  612.      
  613.      C-p 5 0         delete-frame
  614.         ...
  615.      C-p 5 C-f       find-file-other-frame
  616.      
  617.         ...
  618.      
  619.      C-p a i g       inverse-add-global-abbrev
  620.      C-p a i l       inverse-add-mode-abbrev
  621.  
  622. Note that storing a new binding for `C-p C-f' actually works by
  623. changing an entry in `ctl-x-map', and this has the effect of changing
  624. the bindings of both `C-p C-f' and `C-x C-f' in the default global map.
  625.  
  626.  - Function: substitute-key-definition OLDDEF NEWDEF KEYMAP &optional
  627.           OLDMAP
  628.      This function replaces OLDDEF with NEWDEF for any keys in KEYMAP
  629.      that were bound to OLDDEF.  In other words, OLDDEF is replaced
  630.      with NEWDEF wherever it appears.  The function returns `nil'.
  631.  
  632.      For example, this redefines `C-x C-f', if you do it in an XEmacs
  633.      with standard bindings:
  634.  
  635.           (substitute-key-definition
  636.            'find-file 'find-file-read-only (current-global-map))
  637.  
  638.      If OLDMAP is non-`nil', then its bindings determine which keys to
  639.      rebind.  The rebindings still happen in NEWMAP, not in OLDMAP.
  640.      Thus, you can change one map under the control of the bindings in
  641.      another.  For example,
  642.  
  643.           (substitute-key-definition
  644.             'delete-backward-char 'my-funny-delete
  645.             my-map global-map)
  646.  
  647.      puts the special deletion command in `my-map' for whichever keys
  648.      are globally bound to the standard deletion command.
  649.  
  650.  
  651.  - Function: suppress-keymap KEYMAP &optional NODIGITS
  652.      This function changes the contents of the full keymap KEYMAP by
  653.      making all the printing characters undefined.  More precisely, it
  654.      binds them to the command `undefined'.  This makes ordinary
  655.      insertion of text impossible.  `suppress-keymap' returns `nil'.
  656.  
  657.      If NODIGITS is `nil', then `suppress-keymap' defines digits to run
  658.      `digit-argument', and `-' to run `negative-argument'.  Otherwise
  659.      it makes them undefined like the rest of the printing characters.
  660.  
  661.      The `suppress-keymap' function does not make it impossible to
  662.      modify a buffer, as it does not suppress commands such as `yank'
  663.      and `quoted-insert'.  To prevent any modification of a buffer, make
  664.      it read-only (*note Read Only Buffers::.).
  665.  
  666.      Since this function modifies KEYMAP, you would normally use it on
  667.      a newly created keymap.  Operating on an existing keymap that is
  668.      used for some other purpose is likely to cause trouble; for
  669.      example, suppressing `global-map' would make it impossible to use
  670.      most of XEmacs.
  671.  
  672.      Most often, `suppress-keymap' is used to initialize local keymaps
  673.      of modes such as Rmail and Dired where insertion of text is not
  674.      desirable and the buffer is read-only.  Here is an example taken
  675.      from the file `emacs/lisp/dired.el', showing how the local keymap
  676.      for Dired mode is set up:
  677.  
  678.           ...
  679.             (setq dired-mode-map (make-keymap))
  680.             (suppress-keymap dired-mode-map)
  681.             (define-key dired-mode-map "r" 'dired-rename-file)
  682.             (define-key dired-mode-map "\C-d" 'dired-flag-file-deleted)
  683.             (define-key dired-mode-map "d" 'dired-flag-file-deleted)
  684.             (define-key dired-mode-map "v" 'dired-view-file)
  685.             (define-key dired-mode-map "e" 'dired-find-file)
  686.             (define-key dired-mode-map "f" 'dired-find-file)
  687.             ...
  688.  
  689. 
  690. File: lispref.info,  Node: Key Binding Commands,  Next: Scanning Keymaps,  Prev: Changing Key Bindings,  Up: Keymaps
  691.  
  692. Commands for Binding Keys
  693. =========================
  694.  
  695.    This section describes some convenient interactive interfaces for
  696. changing key bindings.  They work by calling `define-key'.
  697.  
  698.    People often use `global-set-key' in their `.emacs' file for simple
  699. customization.  For example,
  700.  
  701.      (global-set-key "\C-x\C-\\" 'next-line)
  702.  
  703. or
  704.  
  705.      (global-set-key [(control ?x) (control ?\\)] 'next-line)
  706.  
  707. or
  708.  
  709.      (global-set-key [?\C-x ?\C-\\] 'next-line)
  710.  
  711. redefines `C-x C-\' to move down a line.
  712.  
  713.      (global-set-key [(meta button1)] 'mouse-set-point)
  714.  
  715. redefines the first (leftmost) mouse button, typed with the Meta key, to
  716. set point where you click.
  717.  
  718.  - Command: global-set-key KEY DEFINITION
  719.      This function sets the binding of KEY in the current global map to
  720.      DEFINITION.
  721.  
  722.           (global-set-key KEY DEFINITION)
  723.           ==
  724.           (define-key (current-global-map) KEY DEFINITION)
  725.  
  726.  - Command: global-unset-key KEY
  727.      This function removes the binding of KEY from the current global
  728.      map.
  729.  
  730.      One use of this function is in preparation for defining a longer
  731.      key that uses KEY as a prefix--which would not be allowed if KEY
  732.      has a non-prefix binding.  For example:
  733.  
  734.           (global-unset-key "\C-l")
  735.               => nil
  736.  
  737.           (global-set-key "\C-l\C-l" 'redraw-display)
  738.               => nil
  739.  
  740.      This function is implemented simply using `define-key':
  741.  
  742.           (global-unset-key KEY)
  743.           ==
  744.           (define-key (current-global-map) KEY nil)
  745.  
  746.  - Command: local-set-key KEY DEFINITION
  747.      This function sets the binding of KEY in the current local keymap
  748.      to DEFINITION.
  749.  
  750.           (local-set-key KEY DEFINITION)
  751.           ==
  752.           (define-key (current-local-map) KEY DEFINITION)
  753.  
  754.  - Command: local-unset-key KEY
  755.      This function removes the binding of KEY from the current local
  756.      map.
  757.  
  758.           (local-unset-key KEY)
  759.           ==
  760.           (define-key (current-local-map) KEY nil)
  761.  
  762. 
  763. File: lispref.info,  Node: Scanning Keymaps,  Next: Other Keymap Functions,  Prev: Key Binding Commands,  Up: Keymaps
  764.  
  765. Scanning Keymaps
  766. ================
  767.  
  768.    This section describes functions used to scan all the current
  769. keymaps, or all keys within a keymap, for the sake of printing help
  770. information.
  771.  
  772.  - Function: accessible-keymaps KEYMAP &optional PREFIX
  773.      This function returns a list of all the keymaps that can be
  774.      accessed (via prefix keys) from KEYMAP.  The value is an
  775.      association list with elements of the form `(KEY . MAP)', where
  776.      KEY is a prefix key whose definition in KEYMAP is MAP.
  777.  
  778.      The elements of the alist are ordered so that the KEY increases in
  779.      length.  The first element is always `([] . KEYMAP)', because the
  780.      specified keymap is accessible from itself with a prefix of no
  781.      events.
  782.  
  783.      If PREFIX is given, it should be a prefix key sequence; then
  784.      `accessible-keymaps' includes only the submaps whose prefixes start
  785.      with PREFIX.  These elements look just as they do in the value of
  786.      `(accessible-keymaps)'; the only difference is that some elements
  787.      are omitted.
  788.  
  789.      In the example below, the returned alist indicates that the key
  790.      `C-x', which is displayed as `[(control x)]', is a prefix key
  791.      whose definition is the keymap `#<keymap ((control x) #<keymap
  792.      emacs-lisp-mode-map 8 entries 0x546>) 1 entry 0x8a2>'. (The strange
  793.      notation for the keymap's name indicates that this is an internal
  794.      submap of `emacs-lisp-mode-map'.  This is because
  795.      `lisp-interaction-mode-map' has set up `emacs-lisp-mode-map' as
  796.      its parent, and `lisp-interaction-mode-map' defines no key
  797.      sequences beginning with `C-x'.)
  798.  
  799.           (current-local-map)
  800.           => #<keymap lisp-interaction-mode-map 5 entries 0x558>
  801.           (accessible-keymaps (current-local-map))
  802.           =>(([] . #<keymap lisp-interaction-mode-map 5 entries 0x558>)
  803.               ([(control x)] .
  804.                #<keymap ((control x) #<keymap emacs-lisp-mode-map 8 entries 0x546>)
  805.                         1 entry 0x8a2>))
  806.  
  807.      The following example shows the results of calling
  808.      `accessible-keymaps' on a large, complex keymap.  Notice how some
  809.      keymaps were given explicit names using `set-keymap-name'; those
  810.      submaps without explicit names are given descriptive names
  811.      indicating their relationship to their enclosing keymap.
  812.  
  813.           (accessible-keymaps (current-global-map))
  814.           => (([] . #<keymap global-map 639 entries 0x221>)
  815.              ([(control c)] . #<keymap mode-specific-command-prefix 1 entry 0x3cb>)
  816.              ([(control h)] . #<keymap help-map 33 entries 0x4ec>)
  817.              ([(control x)] . #<keymap Control-X-prefix 77 entries 0x3bf>)
  818.              ([(meta escape)] .
  819.                 #<keymap ((meta escape) #<keymap global-map 639 entries 0x221>)
  820.                          3 entries 0x3e0>)
  821.              ([(meta control \[)] .
  822.                 #<keymap ((meta escape) #<keymap global-map 639 entries 0x221>)
  823.                          3 entries 0x3e0>)
  824.              ([f1] . #<keymap help-map 33 entries 0x4ec>)
  825.              ([(control x) \4] . #<keymap ctl-x-4-prefix 9 entries 0x3c5>)
  826.              ([(control x) \5] . #<keymap ctl-x-5-prefix 8 entries 0x3c8>)
  827.              ([(control x) \6] . #<keymap 13 entries 0x4d2>)
  828.              ([(control x) a] .
  829.                 #<keymap (a #<keymap Control-X-prefix 77 entries 0x3bf>)
  830.                          8 entries 0x3ef>)
  831.              ([(control x) n] . #<keymap narrowing-prefix 3 entries 0x3dd>)
  832.              ([(control x) r] . #<keymap rectangle-prefix 18 entries 0x3e9>)
  833.              ([(control x) v] . #<keymap vc-prefix-map 13 entries 0x60e>)
  834.              ([(control x) a i] .
  835.                #<keymap (i #<keymap (a #<keymap Control-X-prefix 77 entries 0x3bf>)
  836.                                     8 entries 0x3ef>)
  837.                         2 entries 0x3f5>))
  838.  
  839.  - Function: map-keymap FUNCTION KEYMAP &optional SORT-FIRST
  840.      This function applies FUNCTION to each element of `KEYMAP'.
  841.      FUNCTION will be called with two arguments: a key-description
  842.      list, and the binding.  The order in which the elements of the
  843.      keymap are passed to the function is unspecified.  If the function
  844.      inserts new elements into the keymap, it may or may not be called
  845.      with them later.  No element of the keymap will ever be passed to
  846.      the function more than once.
  847.  
  848.      The function will not be called on elements of this keymap's
  849.      parents (*note Inheritance and Keymaps::.) or upon keymaps which
  850.      are contained within this keymap (multi-character definitions).
  851.      It will be called on <META> characters since they are not really
  852.      two-character sequences.
  853.  
  854.      If the optional third argument SORT-FIRST is non-`nil', then the
  855.      elements of the keymap will be passed to the mapper function in a
  856.      canonical order.  Otherwise, they will be passed in hash (that is,
  857.      random) order, which is faster.
  858.  
  859.  - Function: keymap-fullness KEYMAP
  860.      This function returns the number of bindings in the keymap.
  861.  
  862.  - Function: where-is-internal DEFINITION &optional KEYMAPS FIRSTONLY
  863.           NOINDIRECT EVENT-OR-KEYS
  864.      This function returns a list of key sequences (of any length) that
  865.      are bound to DEFINITION in a set of keymaps.
  866.  
  867.      The argument DEFINITION can be any object; it is compared with all
  868.      keymap entries using `eq'.
  869.  
  870.      KEYMAPS can be either a keymap (meaning search in that keymap and
  871.      the current global keymap) or a list of keymaps (meaning search in
  872.      exactly those keymaps and no others).  If KEYMAPS is nil, search
  873.      in the currently applicable maps for EVENT-OR-KEYS.
  874.  
  875.      If KEYMAP is a keymap, then the maps searched are KEYMAP and the
  876.      global keymap.  If KEYMAP is a list of keymaps, then the maps
  877.      searched are exactly those keymaps, and no others.  If KEYMAP is
  878.      `nil', then the maps used are the current active keymaps for
  879.      EVENT-OR-KEYS (this is equivalent to specifying `(current-keymaps
  880.      EVENT-OR-KEYS)' as the argument to KEYMAPS).
  881.  
  882.      If FIRSTONLY is non-`nil', then the value is a single vector
  883.      representing the first key sequence found, rather than a list of
  884.      all possible key sequences.
  885.  
  886.      If NOINDIRECT is non-`nil', `where-is-internal' doesn't follow
  887.      indirect keymap bindings.  This makes it possible to search for an
  888.      indirect definition itself.
  889.  
  890.      This function is used by `where-is' (*note Help: (emacs)Help.).
  891.  
  892.           (where-is-internal 'describe-function)
  893.               => ([(control h) d] [(control h) f] [f1 d] [f1 f])
  894.  
  895.  - Function: describe-bindings-internal MAP &optional ALL SHADOW PREFIX
  896.           MOUSE-ONLY-P
  897.      This function inserts (into the current buffer) a list of all
  898.      defined keys and their definitions in MAP.  Optional second
  899.      argument ALL says whether to include even "uninteresting"
  900.      definitions, i.e.  symbols with a non-`nil' `suppress-keymap'
  901.      property.  Third argument SHADOW is a list of keymaps whose
  902.      bindings shadow those of map; if a binding is present in any
  903.      shadowing map, it is not printed.  Fourth argument PREFIX, if
  904.      non-`nil', should be a key sequence; only bindings which start
  905.      with that key sequence will be printed.  Fifth argument
  906.      MOUSE-ONLY-P says to only print bindings for mouse clicks.
  907.  
  908.    `describe-bindings-internal' is used to implement the help command
  909. `describe-bindings'.
  910.  
  911.  - Command: describe-bindings PREFIX MOUSE-ONLY-P
  912.      This function creates a listing of all defined keys and their
  913.      definitions.  It writes the listing in a buffer named `*Help*' and
  914.      displays it in a window.
  915.  
  916.      If PREFIX is non-`nil', it should be a prefix key; then the
  917.      listing includes only keys that start with PREFIX.
  918.  
  919.      When several characters with consecutive ASCII codes have the same
  920.      definition, they are shown together, as `FIRSTCHAR..LASTCHAR'.  In
  921.      this instance, you need to know the ASCII codes to understand
  922.      which characters this means.  For example, in the default global
  923.      map, the characters `<SPC> .. ~' are described by a single line.
  924.      <SPC> is ASCII 32, `~' is ASCII 126, and the characters between
  925.      them include all the normal printing characters, (e.g., letters,
  926.      digits, punctuation, etc.); all these characters are bound to
  927.      `self-insert-command'.
  928.  
  929.      If the second argument (prefix arg, interactively) is non-`nil'
  930.      then only the mouse bindings are displayed.
  931.  
  932. 
  933. File: lispref.info,  Node: Other Keymap Functions,  Prev: Scanning Keymaps,  Up: Keymaps
  934.  
  935. Other Keymap Functions
  936. ======================
  937.  
  938.  - Function: set-keymap-prompt KEYMAP NEW-PROMPT
  939.      This function sets the "prompt" of KEYMAP to string NEW-PROMPT, or
  940.      `nil' if no prompt is desired.  The prompt is shown in the
  941.      echo-area when reading a key-sequence to be looked-up in this
  942.      keymap.
  943.  
  944.  - Function: keymap-prompt KEYMAP &optional USE-INHERITED
  945.      This function returns the "prompt" of the given keymap.  If
  946.      USE-INHERITED is non-`nil', any parent keymaps will also be
  947.      searched for a prompt.
  948.  
  949. 
  950. File: lispref.info,  Node: Menus,  Next: Dialog Boxes,  Prev: Keymaps,  Up: Top
  951.  
  952. Menus
  953. *****
  954.  
  955. * Menu:
  956.  
  957. * Menu Format::        Format of a menu description.
  958. * Menubar Format::    How to specify a menubar.
  959. * Menubar::        Functions for controlling the menubar.
  960. * Modifying Menus::    Modifying a menu description.
  961. * Pop-Up Menus::    Functions for specifying pop-up menus.
  962. * Menu Filters::    Filter functions for the default menubar.
  963. * Menu Accelerators::    Using and controlling menu accelerator keys
  964. * Buffers Menu::    The menu that displays the list of buffers.
  965.  
  966. 
  967. File: lispref.info,  Node: Menu Format,  Next: Menubar Format,  Up: Menus
  968.  
  969. Format of Menus
  970. ===============
  971.  
  972.    A menu is described using a "menu description", which is a list of
  973. menu items, keyword-value pairs, strings, and submenus.  The menu
  974. description specifies which items are present in the menu, what function
  975. each item invokes, and whether the item is selectable or not.  Pop-up
  976. menus are directly described with a menu description, while menubars are
  977. described slightly differently (see below).
  978.  
  979.    The first element of a menu must be a string, which is the name of
  980. the menu.  This is the string that will be displayed in the parent menu
  981. or menubar, if any.  This string is not displayed in the menu itself,
  982. except in the case of the top level pop-up menu, where there is no
  983. parent.  In this case, the string will be displayed at the top of the
  984. menu if `popup-menu-titles' is non-`nil'.
  985.  
  986.    Immediately following the first element there may optionally be up
  987. to four keyword-value pairs, as follows:
  988.  
  989. `:included FORM'
  990.      This can be used to control the visibility of a menu.  The form is
  991.      evaluated and the menu will be omitted if the result is `nil'.
  992.  
  993. `:config SYMBOL'
  994.      This is an efficient shorthand for `:included (memq SYMBOL
  995.      menubar-configuration)'.  See the variable `menubar-configuration'.
  996.  
  997. `:filter FUNCTION'
  998.      A menu filter is used to sensitize or incrementally create a
  999.      submenu only when it is selected by the user and not every time
  1000.      the menubar is activated.  The filter function is passed the list
  1001.      of menu items in the submenu and must return a list of menu items
  1002.      to be used for the menu.  It is called only when the menu is about
  1003.      to be displayed, so other menus may already be displayed.  Vile
  1004.      and terrible things will happen if a menu filter function changes
  1005.      the current buffer, window, or frame.  It also should not raise,
  1006.      lower, or iconify any frames.  Basically, the filter function
  1007.      should have no side-effects.
  1008.  
  1009. `:accelerator KEY'
  1010.      A menu accelerator is a keystroke which can be pressed while the
  1011.      menu is visible which will immediately activate the item.  KEY
  1012.      must be a char or the symbol name of a key.  *Note Menu
  1013.      Accelerators::.
  1014.  
  1015.    The rest of the menu consists of elements as follows:
  1016.  
  1017.    * A "menu item", which is a vector in the following form:
  1018.  
  1019.           `[ NAME CALLBACK :KEYWORD VALUE :KEYWORD VALUE ... ]'
  1020.  
  1021.      NAME is a string, the name of the menu item; it is the string to
  1022.      display on the menu.  It is filtered through the resource
  1023.      database, so it is possible for resources to override what string
  1024.      is actually displayed.
  1025.  
  1026.      CALLBACK is a form that will be invoked when the menu item is
  1027.      selected.  If the callback of a menu item is a symbol, then it
  1028.      must name a command.  It will be invoked with
  1029.      `call-interactively'.  If it is a list, then it is evaluated with
  1030.      `eval'.
  1031.  
  1032.      The valid keywords and their meanings are described below.
  1033.  
  1034.      Note that for compatibility purposes, the form
  1035.  
  1036.           `[ NAME CALLBACK ACTIVE-P ]'
  1037.  
  1038.      is also accepted and is equivalent to
  1039.  
  1040.           `[ NAME CALLBACK :active ACTIVE-P ]'
  1041.  
  1042.      and the form
  1043.  
  1044.           `[ NAME CALLBACK ACTIVE-P SUFFIX]'
  1045.  
  1046.      is accepted and is equivalent to
  1047.  
  1048.           `[ NAME CALLBACK :active ACTIVE-P :suffix SUFFIX]'
  1049.  
  1050.      However, these older forms are deprecated and should generally not
  1051.      be used.
  1052.  
  1053.    * If an element of a menu is a string, then that string will be
  1054.      presented in the menu as unselectable text.
  1055.  
  1056.    * If an element of a menu is a string consisting solely of hyphens,
  1057.      then that item will be presented as a solid horizontal line.
  1058.  
  1059.    * If an element of a menu is a string beginning with `--:', then a
  1060.      particular sort of horizontal line will be displayed, as follows:
  1061.  
  1062.     `"--:singleLine"'
  1063.           A solid horizontal line.  This is equivalent to a string
  1064.           consisting solely of hyphens.
  1065.  
  1066.     `"--:doubleLine"'
  1067.           A solid double horizontal line.
  1068.  
  1069.     `"--:singleDashedLine"'
  1070.           A dashed horizontal line.
  1071.  
  1072.     `"--:doubleDashedLine"'
  1073.           A dashed double horizontal line.
  1074.  
  1075.     `"--:noLine"'
  1076.           No line (but a small space is left).
  1077.  
  1078.     `"--:shadowEtchedIn"'
  1079.           A solid horizontal line with a 3-d recessed appearance.
  1080.  
  1081.     `"--:shadowEtchedOut"'
  1082.           A solid horizontal line with a 3-d pushed-out appearance.
  1083.  
  1084.     `"--:shadowDoubleEtchedIn"'
  1085.           A solid double horizontal line with a 3-d recessed appearance.
  1086.  
  1087.     `"--:shadowDoubleEtchedOut"'
  1088.           A solid double horizontal line with a 3-d pushed-out
  1089.           appearance.
  1090.  
  1091.     `"--:shadowEtchedInDash"'
  1092.           A dashed horizontal line with a 3-d recessed appearance.
  1093.  
  1094.     `"--:shadowEtchedOutDash"'
  1095.           A dashed horizontal line with a 3-d pushed-out appearance.
  1096.  
  1097.     `"--:shadowDoubleEtchedInDash"'
  1098.           A dashed double horizontal line with a 3-d recessed
  1099.           appearance.
  1100.  
  1101.     `"--:shadowDoubleEtchedOutDash"'
  1102.           A dashed double horizontal line with a 3-d pushed-out
  1103.           appearance.
  1104.  
  1105.    * If an element of a menu is a list, it is treated as a submenu.
  1106.      The name of that submenu (the first element in the list) will be
  1107.      used as the name of the item representing this menu on the parent.
  1108.  
  1109.    The possible keywords are as follows:
  1110.  
  1111. :active FORM
  1112.      FORM will be evaluated when the menu that this item is a part of
  1113.      is about to be displayed, and the item will be selectable only if
  1114.      the result is non-`nil'.  If the item is unselectable, it will
  1115.      usually be displayed grayed-out to indicate this.
  1116.  
  1117. :suffix STRING
  1118.      The string is appended to the displayed name.  This provides a
  1119.      convenient way of adding the name of a command's "argument" to the
  1120.      menu, like `Kill Buffer NAME'.
  1121.  
  1122. :keys STRING
  1123.      Normally, the keyboard equivalents of commands in menus are
  1124.      displayed when the "callback" is a symbol.  This can be used to
  1125.      specify keys for more complex menu items.  It is passed through
  1126.      `substitute-command-keys' first.
  1127.  
  1128. :style STYLE
  1129.      Specifies what kind of object this menu item is.  STYLE be one of
  1130.      the symbols
  1131.  
  1132.     `nil'
  1133.           A normal menu item.
  1134.  
  1135.     `toggle'
  1136.           A toggle button.
  1137.  
  1138.     `radio'
  1139.           A radio button.
  1140.  
  1141.     `button'
  1142.           A menubar button.
  1143.  
  1144.      The only difference between toggle and radio buttons is how they
  1145.      are displayed.  But for consistency, a toggle button should be
  1146.      used when there is one option whose value can be turned on or off,
  1147.      and radio buttons should be used when there is a set of mutually
  1148.      exclusive options.  When using a group of radio buttons, you
  1149.      should arrange for no more than one to be marked as selected at a
  1150.      time.
  1151.  
  1152. :selected FORM
  1153.      Meaningful only when STYLE is `toggle', `radio' or `button'.  This
  1154.      specifies whether the button will be in the selected or unselected
  1155.      state.  FORM is evaluated, as for `:active'.
  1156.  
  1157. :included FORM
  1158.      This can be used to control the visibility of a menu item.  The
  1159.      form is evaluated and the menu item is only displayed if the
  1160.      result is non-`nil'.  Note that this is different from `:active':
  1161.      If `:active' evaluates to `nil', the item will be displayed grayed
  1162.      out, while if `:included' evaluates to `nil', the item will be
  1163.      omitted entirely.
  1164.  
  1165. :config SYMBOL
  1166.      This is an efficient shorthand for `:included (memq SYMBOL
  1167.      menubar-configuration)'.  See the variable `menubar-configuration'.
  1168.  
  1169. :accelerator KEY
  1170.      A menu accelerator is a keystroke which can be pressed while the
  1171.      menu is visible which will immediately activate the item.  KEY
  1172.      must be a char or the symbol name of a key.  *Note Menu
  1173.      Accelerators::.
  1174.  
  1175.  - Variable: menubar-configuration
  1176.      This variable holds a list of symbols, against which the value of
  1177.      the `:config' tag for each menubar item will be compared.  If a
  1178.      menubar item has a `:config' tag, then it is omitted from the
  1179.      menubar if that tag is not a member of the `menubar-configuration'
  1180.      list.
  1181.  
  1182.    For example:
  1183.  
  1184.       ("File"
  1185.        :filter file-menu-filter    ; file-menu-filter is a function that takes
  1186.                      ; one argument (a list of menu items) and
  1187.                      ; returns a list of menu items
  1188.        [ "Save As..."    write-file  t ]
  1189.        [ "Revert Buffer" revert-buffer (buffer-modified-p) ]
  1190.        [ "Read Only"     toggle-read-only :style toggle :selected buffer-read-only ]
  1191.        )
  1192.  
  1193. 
  1194. File: lispref.info,  Node: Menubar Format,  Next: Menubar,  Prev: Menu Format,  Up: Menus
  1195.  
  1196. Format of the Menubar
  1197. =====================
  1198.  
  1199.    A menubar is a list of menus, menu items, and strings.  The format is
  1200. similar to that of a menu, except:
  1201.  
  1202.    * The first item need not be a string, and is not treated specially.
  1203.  
  1204.    * A string consisting solely of hyphens is not treated specially.
  1205.  
  1206.    * If an element of a menubar is `nil', then it is used to represent
  1207.      the division between the set of menubar items which are flush-left
  1208.      and those which are flush-right.  (Note: this isn't completely
  1209.      implemented yet.)
  1210.  
  1211.